<template>
  <a-card :bordered="false">
    <!-- 查询区域 -->
    <search ref='search' :config='searchConfig' @search='search' @getHeight='getHeight' />
    <!-- table区域-begin -->
    <div class='page_table'>
      <vxe-grid
        ref='xGrid'
        :border='true'
        :resizable='true'
        :showOverflow='true'
        size='mini'
        :loading='loading'
        :height='pageHeight-seachHeight-90'
        :align='left'
        :columns='columns'
        :data='dataSource'
        :rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}"
        :toolbar-config='tableToolbar'
        :checkbox-config="checkboxConfig"
        v-bind='vexConfig'
        @checkbox-change='selectChangeEvent'
        @checkbox-all='selectChangeEvent'
      >
        <template #toolbar_buttons>
          <div class='table-operator'>
            <a-button type="primary" @click="downExportXls('sfaVisitDisplay_service')">导出</a-button>
          </div>
        </template>

        <template #status='{ row }'>
          <a-switch :checked='row.status' size='small' @change='handleStatus(row,$event)' />
        </template>
        <template #action='{ row:record }'>
          <a @click='handleEdit1(record)'>编辑</a>
          <span v-if='record.fileUrl'>
            <a-divider type='vertical' />
            <a :href='record.fileUrl'>下载</a>
          </span>
        </template>
        <template #displayUrl='{ row }'>
          <viewer :images='row.displayUrl'>
            <a-avatar :src='row.displayUrl' icon='user' shape='square' />
          </viewer>
        </template>
        <template #pager>
          <vxe-pager
            :layouts="['Total', 'PrevJump', 'PrevPage', 'Number', 'NextPage', 'NextJump','Sizes', 'FullJump']"
            :currentPage.sync='ipagination.current'
            :page-size.sync='ipagination.pageSize'
            :total='ipagination.total'
            :pageSizes='ipagination.pageSizeOptions'
            @page-change='handlePageChange'>
          </vxe-pager>
        </template>
      </vxe-grid>
    </div>
    <!-- table区域-end -->

    <!-- 表单区域 -->
    <sfaVisitDisplayEntity-modal ref="modalForm" @ok="modalFormOk"></sfaVisitDisplayEntity-modal>
  </a-card>
</template>

<script>
  import '@/assets/less/TableExpand.less'
  import SfaVisitDisplayEntityModal from './modules/SfaVisitDisplayModal'
  import { PageListMixin } from '@/mixins/PageListMixin'
  import { getFileAccessHttpUrl } from '@api/manage'

  export default {
    name: "SfaVisitDisplayList",
    mixins: [PageListMixin],
    components: {
      SfaVisitDisplayEntityModal
    },
    data() {
      return {
        //查询区域
        description: '拜访陈列',
        searchConfig: [
          {
            type: 'input',
            name: 'createName',
            placeholder: '提交人'
          },
          {
            type: 'date',
            name: 'createDate',
            placeholder: '提交日期'
          },
          {
            type: 'input',
            name: 'terminalCode',
            placeholder: '门店编码'
          },
          {
            type: 'input',
            name: 'terminalName',
            placeholder: '门店名称'
          },
        ],
        // 表头
        columns: [
          { type: 'checkbox', width: 60, fixed: 'left' },
          {
            title: '提交人',
            minWidth: 80,
            field: 'createName'
          },
          {
            title: '提交日期',
            minWidth: 80,
            field: 'createDate'
          },
          {
            title: '提交人职位',
            minWidth: 80,
            field: 'positionName'
          },
          {
            title: '提交人组织',
            minWidth: 80,
            field: 'orgName'
          },
          {
            title: '网点编码',
            minWidth: 80,
            field: 'clientCode'
          },
          {
            title: '网点名称',
            minWidth: 80,
            field: 'clientName'
          },
          {
            title: '所属组织编码',
            minWidth: 120,
            field: 'terminOrgCode'
          },
          {
            title: '所属组织名称',
            minWidth: 120,
            field: 'terminOrgName'
          },
          {
            title: '渠道类型',
            minWidth: 80,
            field: 'termChannel'
          },
          {
            title: '门店类型',
            minWidth: 80,
            field: 'terminalType'
          },
          {
            title: '门店等级',
            minWidth: 80,
            field: 'terminalLevel'
          },
          // {
          //   title: '供给',
          //   minWidth:80,
          //   field: 'supply'
          // },
          {
            title: '陈列类型',
            minWidth: 80,
            field: 'displayType'
          },
          {
            title: '拜访编号',
            minWidth: 80,
            field: 'visitId'
          },
          {
            title: '拜访类型',
            minWidth: 80,
            field: 'visitType'
          },
          {
            title: '陈列图片',
            minWidth: 80,
            field: 'displayUrl',
            slots: { default: 'displayUrl' },
          }
        ],
        url: {
          list: window._CONFIG['domianSfaURL'] + "/visit/sfaVisitDisplayController/findPageList",
          exportXlsUrl: window._CONFIG['domianSfaURL'] + "/visit/sfaVisitDisplayController/todoExcel"
        }
      }
    },
    computed: {
      importExcelUrl: function() {
        return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`;
      }
    },
    methods: {}
  }
</script>
<style scoped>
  @import '~@assets/less/common.less';
  /*动画*/
  .fade-enter-active,
  .fade-leave-active {
    transition: all .2s linear;
    transform: translate3D(0, 0, 0);
  }

  .fade-enter,
  .fade-leave-active {
    transform: translate3D(100%, 0, 0);
  }

  /* bigimg */

  .img-view {
    position: relative;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
  }

  /*遮罩层样式*/
  .img-view .img-layer {
    position: fixed;
    z-index: 99998;
    top: 0;
    left: 0;
    background: rgba(0, 0, 0, 0.7);
    width: 100%;
    height: 100%;
    overflow: hidden;
  }

  /*不限制图片大小，实现居中*/
  .img-view .img img {
    position: absolute;
    min-width: 50%;
    max-width: 50%;
    display: block;
    left: 0;
    right: 0;
    margin: auto;
    z-index: 99999;
  }
  .left {
    position: absolute;
    min-width: 20%;
    max-width: 20%;
    display: block;
    left: 0px;
    margin: auto;
    z-index: 99999;
    top: 50%;
  }
  .right {
    position: absolute;
    min-width: 20%;
    max-width: 20%;
    display: block;
    right: 0px;top: 50%;
    margin: auto;
    z-index: 99999;
  }
</style>